Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
utility to convert json to a excel file, based on Node-Excel-Export
npm install json2xls
Use to save as file:
var json2xls = require('json2xls');
var json = {
foo: 'bar',
qux: 'moo',
poo: 123,
stux: new Date()
}
var xls = json2xls(json);
fs.writeFileSync('data.xlsx', xls, 'binary');
Or use as express middleware. It adds a convenience xls
method to the response object to immediately output an excel as download.
var jsonArr = [{
foo: 'bar',
qux: 'moo',
poo: 123,
stux: new Date()
},
{
foo: 'bar',
qux: 'moo',
poo: 345,
stux: new Date()
}];
app.use(json2xls.middleware);
app.get('/',function(req, res) {
res.xls('data.xlsx', jsonArr);
});
As a second parameter to json2xls
or a third parameter to res.xls
, a map of options can be passed:
var xls = json2xls(json, options);
res.xls('data.xlsx', jsonArr, options);
The following options are supported:
- style: a styles xml file, see <https://github.com/functionscope/Node-Excel-Export>
- fields: either an array or map containing field configuration:
- array: a list of names of fields to be exported, in that order
- object: a map of names of fields to be exported and the types of those fields. Supported types are 'number','string','bool'
Example:
var json2xls = require('json2xls');
var json = {
foo: 'bar',
qux: 'moo',
poo: 123,
stux: new Date()
}
//export only the field 'poo'
var xls = json2xls(json,{
fields: ['poo']
});
//export only the field 'poo' as string
var xls = json2xls(json,{
fields: {poo:'string'}
});
fs.writeFileSync('data.xlsx', xls, 'binary');
FAQs
canonically transform json to an excel document
The npm package json2xls receives a total of 23,606 weekly downloads. As such, json2xls popularity was classified as popular.
We found that json2xls demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.